<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content ">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default"
                   data-original-title="返回管理员列表"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>提现申请</h3>
                </div>
                <div class="panel-body ">
                    <!--表单数据-->
                    <form method="post" id="withdrawals_form">
                        <!--通用信息-->
                        <div class="tab-content col-md-10">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                    <tr>
                                        <td class="col-sm-2">提现金额：</td>
                                        <td class="col-sm-6">
                                            <input type="text" class="form-control"
                                                   onkeyup="this.value=this.value.replace(/[^\d.]/g,'')"
                                                   onpaste="this.value=this.value.replace(/[^\d.]/g,'')"
                                                   placeholder="最少提现额度{$withdrawals_min}" name="money" id="money"
                                                   value="{$withdrawals.money}"/>
                                        </td>
                                        <td class="col-sm-4"></td>
                                    </tr>
                                    <tr>
                                        <td>银行名称：</td>
                                        <td>
                                            <input type="text" class="form-control" placeholder="如:支付宝,农业银行,工商银行等..."
                                                   name="bank_name" id="bank_name" value="{$withdrawals.bank_name}"/>
                                        </td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>收款账号：</td>
                                        <td>
                                            <input type="text" class="form-control" placeholder="如:支付宝账号,建设银行账号"
                                                   name="account_bank" id="account_bank"
                                                   value="{$withdrawals.account_bank}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>开户名：</td>
                                        <td>
                                            <input type="text" class="form-control" placeholder="开户人姓名"
                                                   name="account_name" id="account_name"
                                                   value="{$withdrawals.account_name}"/>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td>
                                            <input type="hidden" name="id" value="{$withdrawals.id}">
                                        </td>
                                        <td class="text-right"><input class="btn btn-primary" type="button"
                                                                      onclick="checkSubmit()" value="保存"></td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </form><!--表单数据-->
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    var withdrawals_min = {$withdrawals_min};
    var withdrawals_max = {$withdrawals_max};

    // 表单验证提交
    function checkSubmit() {

        var money = $.trim($('#money').val());
        var bank_name = $.trim($('#bank_name').val());
        var account_bank = $.trim($('#account_bank').val());
        var account_name = $.trim($('#account_name').val());

        if (money == '') {
            alert('提现金额必填');
            return false;
        }

        if (withdrawals_min > withdrawals_max) {
            alert('对不起，您的可申请提现金额小于最少提现额度￥' + withdrawals_min + ',暂不能提现');
            return false;
        }
        if (money < withdrawals_min) {
            alert('提现金额必须大于' + withdrawals_min);
            return false;
        }
        if (money > withdrawals_max) {
            alert('对不起，您的申请提现金额已经超过您的可申请提现金额￥' + withdrawals_max);
            return false;
        }
        if (bank_name == '') {
            alert('银行名称必填');
            return false;
        }
        if (account_bank == '') {
            alert('收款账号必填');
            return false;
        }
        if (account_name == '') {
            alert('开户名必填');
            return false;
        }

        $('#withdrawals_form').submit();
    }
</script>
</body>
</html>